<template>
  <el-card>
    <div slot="header">
      <h3>临时项目商品-查看</h3>
    </div>
    <div class="project_goods_edit">
      <el-row>
        <SkusTable
          ref="skusTable"
          :dataSource="tableInfo.list"
          :columns="tableInfo.columns"
          :loading="tableInfo.loading"
        />
      </el-row>
      <TableFooter :data-source="operInfo" />
    </div>
  </el-card>
</template>
<script>
import SkusTable from '@/components/skusTable';
import { VIEW_TABLE_COLUMNS } from './constants/edit';
import TableFooter from '../components/TableFooter';
import {
  querySubmittedInfoService,
} from '@/api/commodity/temporaryPurchasingGoods/temporaryProjectGoods';
import skusPage from '@/mixins/commodity/skusPage';
export default {
  mixins: [skusPage],
  components: {
    SkusTable,
    TableFooter
  },
  data () {
    return {
      tableInfo: {
        list: [],
        columns: VIEW_TABLE_COLUMNS,
        selection: [],
        loading: false
      },
      operInfo: {}
    }
  },
  mounted () {
    const { productUuid } = this.$route.query;
    this.getTableData(productUuid);
  },
  methods: {
    async getTableData (uuid) {
      const res = await querySubmittedInfoService([uuid], '.project_goods_edit');
      if (res) {
        this.tableInfo.list = res.retData;
        const { operName, opeTime, operDeptName } = res.retData[0];
        this.operInfo = { operName, opeTime, operDeptName };
      }
    },
  }
}
</script>
